package com.shop.service.impl;

import com.shop.common.RedisUtil;
import com.shop.common.SendMessageUtil;
import com.shop.common.UserInfoUtil;
import com.shop.common.result.Result;
import com.shop.common.result.util.ResultModel;
import com.shop.entity.CommodityDo;
import com.shop.entity.MerchantDo;
import com.shop.mapper.MerchantDoMapper;
import com.shop.service.MerchantService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.vo.AddMerchantVo;
import com.shop.vo.commodity.AddCommodityVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商户表 服务实现类
 * </p>
 *
 * @author 靳 旺
 * @since 2021-01-29
 */
@Service
public class MerchantServiceImpl extends ServiceImpl<MerchantDoMapper, MerchantDo> implements MerchantService {

    @Autowired
    private UserInfoUtil userInfoUtil;

    @Autowired
    private RedisUtil redisUtil;

    @Autowired
    private SendMessageUtil sendMessageUtil;


    /**
     * 添加商户
     *
     * @param addMerchantVo
     * @return
     * @throws Exception
     */
    @Override
    public ResultModel addMerchant(AddMerchantVo addMerchantVo) throws Exception {
        MerchantDo merchantDo = new MerchantDo();
//        merchantDo.setMerchantsNo(addMerchantVo);
//        commodityDo.setPrice(addCommodityVo.getPrice());
//        commodityDo.setSize(addCommodityVo.getSize());
//        commodityDo.setCommodityNo(addCommodityVo.getCommodityNo());
//        commodityDo.setTitle(addCommodityVo.getTitle());
//        clientDo.setIsDel("n");
        if (baseMapper.insert(merchantDo) <= 0) throw new Exception("添加失败！");
//        return commodityDo;
        return Result.successResultModel();
    }


}
